package com.kvest.SlidingMenuTest;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.TextView;
import com.actionbarsherlock.view.MenuItem;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;

/**
 * Created with IntelliJ IDEA.
 * User: roman
 * Date: 8/23/13
 * Time: 3:06 PM
 * To change this template use File | Settings | File Templates.
 */
public class TestSlidingActivity extends SlidingActivity {

    @Override
    public void onCreate(Bundle savedState) {
        super.onCreate(savedState);

        TextView tw = new TextView(this);
        tw.setText("THis is content");
        tw.setBackgroundColor(Color.RED);
     //   tw.setLayoutParams();
        setContentView(tw);

//        tw = new TextView(this);
//        tw.setText("THis is menu");
//        tw.setBackgroundColor(Color.GREEN);
//        tw.setLayoutParams();
//        setBehindContentView(tw, new ViewGroup.LayoutParams(100, 100));
        setBehindContentView(R.layout.left_menu);

//        tw = new TextView(this);
//        tw.setText("THis is secondary menu");
//        tw.setBackgroundColor(Color.BLUE);
//        tw.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
//        getSlidingMenu().setSecondaryMenu(tw);
        getSlidingMenu().setSecondaryMenu(R.layout.right_menu);

        SlidingMenu sm = getSlidingMenu();
//        sm.setShadowWidth(10 * 3);
//        sm.setShadowDrawable(R.drawable.shadow);
        sm.setBehindOffset(120);
        sm.setFadeDegree(0.35f);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setIcon(R.drawable.icon);

        getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                toggle();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

}
